package com.jingtai.platform.controller.supply;

import com.jingtai.core.entity.supply.SupplyAddress;
import com.jingtai.platform.service.supply.SupplyAddressService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 供应商收货地址表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/supplyaddress")
@Api(tags = "供应商收货地址表")
public class SupplyAddressController{

    @Autowired
    private SupplyAddressService supplyAddressService;


    @ApiOperation("供应商收货地址表列表查询")
    @GetMapping("/list")
    public ResultUtil aopSupplyAddressList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return supplyAddressService.SupplyAddresslist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询supplyAddress实体")
    @GetMapping("/getSupplyAddressById")
    public ResultUtil GetSupplyAddressById(@CApiParam(name = "id",value = "supplyAddress实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyAddressService.getSupplyAddressById(id);
    }


    @ApiOperation("新增supplyAddress实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"supplyAddress.id","supplyAddress.createTime","supplyAddress.updateTime","supplyAddress.deleteFlag"})
    public ResultUtil aopAddSupplyAddress(@RequestBody @Validated SupplyAddress supplyAddress){
        return supplyAddressService.addSupplyAddress(supplyAddress);
    }

    @ApiOperation("编辑supplyAddress实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"supplyAddress.createTime","supplyAddress.updateTime","supplyAddress.deleteFlag"})
    public ResultUtil aopEditSupplyAddress(@RequestBody @Validated SupplyAddress supplyAddress){
        return supplyAddressService.editSupplyAddress(supplyAddress);
    }

    @ApiOperation("根据ID删除supplyAddress实体")
    @GetMapping("/delSupplyAddressById")
    public ResultUtil aopDelSupplyAddressById(@CApiParam(name = "id",value = "supplyAddress实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return supplyAddressService.delSupplyAddressById(id);
    }

}






